package com.princess.demok.ui.demo.model

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

/**
 * @author: xha
 * @date: 2021/4/12 15:00
 * @Description:
 */
open class NameViewModel : ViewModel() {
    // Create a LiveData with a String
    private var mCurrentName: MutableLiveData<String>? = null
    // Create a LiveData with a String list
    private var mNameListData: MutableLiveData<List<String>>? = null

    open fun currentName(): MutableLiveData<String> {
        if (mCurrentName == null) {
            mCurrentName = MutableLiveData()
        }
        return mCurrentName as MutableLiveData<String>
    }

    open fun nameList(): MutableLiveData<List<String>> {
        if (mNameListData == null) {
            mNameListData = MutableLiveData()
        }
        return mNameListData as MutableLiveData<List<String>>
    }

    // Create a LiveData with a String
    val currentName: MutableLiveData<String> by lazy {
        MutableLiveData<String>()
    }


}